package com.cn.dto;

import com.cn.common.parameter.Common;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;
import java.util.Set;

//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.security.core.userdetails.UserDetails;

@Data
public class UserDto extends Common implements UserDetails {

    @ApiModelProperty(value = "用户名",example = "张三")
    private String username;
    private String password;
    private Integer type;
    @ApiModelProperty(value = "用户邮箱",example = "41545@qq.com")
    private String email;
    @ApiModelProperty(value = "用户证件号",example = "5109222222222222")
    private String idcard;
    private String phone;
    @ApiModelProperty(value = "用户头像",example = "../img/..")
    private String anatar;
    @ApiModelProperty(value = "用户性别",example = "男")
    private String sex;
    @ApiModelProperty(value = "用户生日",example = "2000/10/02")
    private Date birthday;
    @ApiModelProperty(value = "用户地址",example = "四川成都")
    private String address;
    @ApiModelProperty(value = "用户介绍",example = "是个人")
    private String content;
    @ApiModelProperty(value = "用户状态",hidden = true)
    private Integer status;
    private Set<? extends GrantedAuthority> authorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}